/* eslint-disable no-undef */
'use strict';

goog.provide('Blockly.Blocks.SCoop');

goog.require('Blockly.Blocks');
//控模块最后制三个的样式
Blockly.Blocks.SCoop.HUE = "#7600A8";
Blockly.Blocks['SCoopTask'] = {
  init: function () {
    var _tasknum = [["1", "1"], ["2", "2"], ["3", "3"], ["4", "4"], ["5", "5"], ["6", "6"], ["7", "7"], ["8", "8"]];
    this.appendDummyInput()
      .appendField("Scoop Task")
      .appendField(new Blockly.FieldDropdown(_tasknum), "_tasknum");
    this.appendStatementInput("setup")
      .appendField(Blockly.MIXLY_SETUP)
      .setCheck(null);
    this.appendStatementInput("loop")
      .appendField(Blockly.LANG_CONTROLS_FLOW_STATEMENTS_INPUT_OFLOOP)
      .setCheck(null);
    this.setColour(Blockly.Blocks.SCoop.HUE);
    this.setTooltip('');
    this.setHelpUrl('http://www.example.com/');
  }
};

Blockly.Blocks['SCoop_yield'] = {
  init: function () {
    this.setColour(Blockly.Blocks.SCoop.HUE);
    this.appendDummyInput("")
      .appendField(Blockly.Msg.CONTROLS_REPEAT_INPUT_DO + "Scoop");
    this.setPreviousStatement(false, null);
    this.setNextStatement(false, null);
  }
};
Blockly.Blocks['SCoop_sleep'] = {
  init: function () {
    this.setColour(Blockly.Blocks.SCoop.HUE);
    this.appendDummyInput("")
      .appendField(`SCoop${Blockly.MIXLY_DELAY}`);
    this.appendValueInput("sleeplength", Number)
      .setCheck(Number);
    this.appendDummyInput("")
      .appendField(Blockly.MIXLY_MILLIS);
    this.setPreviousStatement(true, null);
    this.setNextStatement(true, null);
  }
};